package org.rxc.gift.service.impl;

import com.baomidou.mybatisplus.plugins.Page;
import org.rxc.gift.domain.Employee;
import org.rxc.gift.mapper.EmployeeMapper;
import org.rxc.gift.query.EmployeeQuery;
import org.rxc.gift.service.IEmployeeService;
import com.baomidou.mybatisplus.service.impl.ServiceImpl;
import org.rxc.gift.util.PageList;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author rxc
 * @since 2024-05-28
 */
@Service
public class EmployeeServiceImpl extends ServiceImpl<EmployeeMapper, Employee> implements IEmployeeService {


    @Autowired
    private EmployeeMapper employeeMapper;
    @Override
    public PageList pageAll(EmployeeQuery query) {

        Page<Employee> page = new Page<>(query.getPage(), query.getRows());

        //只要第一个参数为page对象即可
        List<Employee> employees = employeeMapper.pageAll(page,query);

        return new PageList(page.getTotal(),employees);
    }
}
